#ifndef TIMERNODE_H
#define TIMERNODE_H
#pragma once
#include <memory>
#include "../httpdata.h"

class HttpData;
/**
 * @brief The TimerNode class
 */
class TimerNode
{
public:
    TimerNode(std::shared_ptr<HttpData> requestHttpData, int timeout);

    TimerNode(const TimerNode & node);

    ~TimerNode();

    // 更新定时器
    void update(int timeout);

    // 是否有效
    bool isValid();

    // 清理请求数据
    void cleanRequest();

    // 是否删除了
    inline bool isDelete() {return this->deleted;}

    // 设置删除
    inline void setDelete() {this->deleted = true;}
    // 获取过期时间

    inline int getExpire() {return this->expire;}
private:
    long expire;

    bool deleted;

    std::shared_ptr<HttpData> httpData;
};

#endif // TIMERNODE_H
